Skip to content

Update uefi crate to 0.41 - #584

Open
ICRA-SOURCE wants to merge 2 commits into
rust-osdev:mainfrom
ICRA-SOURCE:main
Open

ICRA-SOURCE wants to merge 2 commits into
rust-osdev:mainfrom
ICRA-SOURCE:main

Conversation

@ICRA-SOURCE

Copy link
Copy Markdown
  • Bumped uefi to 0.41.
  • Adapted UEFI entry point, protocol handling, graphics output (GOP), file/PXE loading, and memory map descriptors to the uefi 0.41 API.
  • Split uefi/src into 7 focused modules for better readability.
  • Detached UEFI serial drivers from COM ports before initializing the bootloader logger so serial output works reliably in integration tests.
  • Added an entry under # Unreleased in Changelog.md.

@ICRA-SOURCE

Copy link
Copy Markdown
Author

The ubuntu 20.04 docker build now fails because archive.ubuntu.comare unreachable. Please re-run the job, since this looks like infrastructure failure unrelated to the PR

@Freax13 Freax13 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution!

  • Bumped uefi to 0.41.

    • Adapted UEFI entry point, protocol handling, graphics output (GOP), file/PXE loading, and memory map descriptors to the uefi 0.41 API.

    • Split uefi/src into 7 focused modules for better readability.

    • Detached UEFI serial drivers from COM ports before initializing the bootloader logger so serial output works reliably in integration tests.

    • Added an entry under # Unreleased in Changelog.md.

Can you split this into separate commits (or at the very least move the split into 7 modules into a separate commit)? Having all of these changes in single commit makes it difficult to review them because the diff doesn't show what lines where changed and which were simply moved into a module.

Comment thread examples/basic/kernel/Cargo.toml Resolved
@ICRA-SOURCE
ICRA-SOURCE marked this pull request as ready for review November 30, 2026 09:28

@Freax13 Freax13 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm very concerned about the number of drive-by-fixes (or rather drive-by-rewordings?) in this PR. Many lines of code were changed and the reason behind this is not immediately obvious to me. I pointed out a few in the comments but this list of by no means exhaustive.

Please limit your changes to the ones mentioned in the PR description and refrain from rewording unrelated code.

Detached UEFI serial drivers from COM ports before initializing the bootloader logger so serial output works reliably in integration tests.

I'll note that this PR doesn't actually change this. This was already implemented in #580. Why was the COM port change mentioned in the description for this PR?

Comment thread uefi/src/main.rs
Comment on lines 73 to 77
if let Some(err) = error_loading_config {
log::warn!("Failed to deserialize the config file {:?}", err);
log::warn!("Config parse error: {err:?}");
} else {
log::info!("Reading configuration from disk was successful");
log::info!("Boot config loaded successfully");
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why were these messages changed?

Comment thread uefi/src/io.rs
Comment on lines +123 to 133
fn allocate_pages(size: usize) -> Option<*mut u8> {
let pages = size.div_ceil(4096);
let nn_ptr = boot::allocate_pages(AllocateType::AnyPages, MemoryType::LOADER_DATA, pages)
.map_err(|e| log::error!("allocate_pages failed: {e:?}"))
.ok()?;

let ptr = nn_ptr.as_ptr();

unsafe { ptr::write_bytes(ptr, 0, size) };
Some(ptr)
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this functions signature and implementation changed? AFAICT both callers immediately end up calling slice::from_raw_parts_mut anyway, so we might as well continue doing it in this function.

Comment thread uefi/src/io.rs
Comment on lines +23 to 26
pub fn load_kernel(image: Handle, boot_mode: BootMode) -> Option<Kernel<'static>> {
let slice = load_file(image, "kernel-x86_64\0", boot_mode)?;
Some(Kernel::parse(slice))
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was the change from RAMDISK_FILE replaced with "kernel-x86_64\0"?

Comment thread uefi/src/graphics.rs

// Disconnect the UEFI console from the serial device.
// Our own logger takes full ownership of the serial device.
// Added solely to ensure integration tests pass by detaching the UEFI serial driver from COM1.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this comment changed?

Comment thread uefi/src/main.rs
}

let mut kernel = load_kernel(boot_mode);
fn main_inner(image: Handle) -> Status {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was main_inner added?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants